import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-08-06
 * Time: 16:41
 * To BE A Better Person-2020-3-2
 */
//英译中
public class UpdDictServer extends UdpEchoServer{
    public Map<String,String> dict=new HashMap<>();

    public UpdDictServer(int port) throws SocketException {
        super(port);
        dict.put("apple","苹果");
        dict.put("banana","香蕉");
        dict.put("orange","橙子");
    }

    @Override
    public String process(String req) {
       return dict.getOrDefault(req,"plese enter the right word");
    }

    public static void main(String[] args) throws IOException {
        UpdDictServer updDictServer=new UpdDictServer(8888);
        updDictServer.start();
    }
}
